package com.example.threaddemo;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.locks.ReentrantLock;

public class ListDemo {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        List<String> list1 = Collections.synchronizedList(new ArrayList<>());
        List<String> list2 = new Vector<>();
        List<String> list3 = new CopyOnWriteArrayList<>();
        Set<String> list4 = new HashSet<>();
        Set<String> list5 = Collections.synchronizedSet( new HashSet<>());
        Set<String> list6 = new CopyOnWriteArraySet<>();

        Map map = new HashMap();
        Map map1 = new ConcurrentHashMap();
        Map map2 = Collections.synchronizedMap( new ConcurrentHashMap());


        new ReentrantLock();
        HashSet set = new HashSet();
        set.add("a");
        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                list3.add(UUID.randomUUID().toString().substring(8));
                    System.out.println(list3);
            },"coco").start();
        }
    }
}
